package krao.parser;

import java.util.regex.Pattern;

import krao.test.QueryParserTest;

import org.apache.log4j.Logger;

public abstract class AtomParser {
	protected final static Logger logger = Logger.getLogger(QueryParserTest.class);

	private static String predicateNameString = "(\\w+)";
	private static String argumentString = "(\\w+)";
	private static String classPatternString = String.format("%s\\(%s\\)?",
			predicateNameString, argumentString);
	public static Pattern classPattern = Pattern.compile(classPatternString);
	private static String rolePatternString = String.format("%s\\(%s,%s\\)?",
			predicateNameString, argumentString, argumentString);
	public static Pattern rolePattern = Pattern.compile(rolePatternString);
	private static String atomPatternString = String.format("(%s|%s)",
			classPatternString, rolePatternString);
	public static Pattern atomPattern = Pattern.compile(atomPatternString);
	private static String queryPatternString = String.format("^%2$s:-%1$s(,%1$s)*$",
			atomPatternString, classPatternString);
	public static Pattern queryPattern = Pattern.compile(queryPatternString);
}
